<!--
 * @Author: your name
 * @Date: 2022-04-26 21:25:12
 * @LastEditTime: 2022-04-27 13:09:35
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: /pocket/Volumes/ExtremeSSD/项目/只跑一次/pages/detail/casList.vue
-->
<template>
  <view class="wrap">
    <view class="detail-wrap">
      <view class="detail-head" v-if="menuDescripe">
        {{ menuDescripe.title }}
      </view>
      <view class="detail-list" v-if="menuDescripe">
        <view
          class="list-item"
          v-for="(itemInner, indexInner) in menuDescripe.list"
          :key="indexInner"
        >
          <view class="list-item-head" v-if="itemInner.head">
            {{ `${indexInner + 1}、${itemInner.head}` }}
          </view>
        </view>
      </view>
    </view>

    <u-cell-group>
      <u-cell-item
        :title="item.title"
        v-for="(item, index) in menuContent"
        :key="index"
        :arrow="true"
        @click="goToDetail(item)"
        hover-class="cell-hover-class"
      ></u-cell-item>
    </u-cell-group>
  </view>
</template>

<script>
import { mapState } from 'vuex';
export default {
  data() {
    return {
      menuContent: [],
      menuDescripe: null,
    };
  },
  computed: {
    ...mapState(['detailData']),
  },
  onLoad() {},
  onShow() {
    this.initPage();
  },
  methods: {
    goToDetail(item) {
      this.$u.vuex('subDetailData', { data: item });
      this.$u.vuex('menuType', 2);
      let url = 'pages/detail/casDetail';
      //   if (item.subMenu === '薪酬劳务' || item.subMenu === '科研报销') {
      //     url = 'pages/detail/casList';
      //   }
      this.$u.route({
        url,
        params: {
          ...item,
        },
      });
    },
    initPage() {
      const detailData = this.detailData?.data || '';
      const menuContent = this.detailData?.data?.menuContent;
      const menuDescripe = this.detailData?.data?.menuDescripe;
      this.menuDescripe = menuDescripe;
      this.menuContent = menuContent || [];
      //   console.log(this.detailData, '页面数据', menuContent);
      uni.setNavigationBarTitle({
        title: detailData.subMenu,
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.detail-wrap {
  margin: 12px;
}
.detail-head {
  font-size: 16px;
  font-weight: 800;
  margin: 0 0 6px 0;
}
.detail-list {
  padding: 0 0 6px 0;
  .list-item {
    .list-item-head {
      padding: 4px 0;
      font-size: 14px;
      // font-weight: 600;
    }
    .list-item-subscrice {
      padding: 4px 0;
      font-size: 14px;
      font-weight: 400;
    }
  }
}
</style>
